package com.tedu.dao;

import com.tedu.pojo.Information;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 对党建信息  mapper
 */

@Mapper
public interface InforNewsMapper {

    /**
     * 通过党建信息  类型的id 获取数据
     * @param type
     * @return
     */
    @Select("SELECT * FROM information WHERE type = #{type} LIMIT #{currentpage},20")
    public List<Information>  getInformationByType(int type,int currentpage);

    /**
     * 通过信息类型 id获取总条数
     * @param topicID
     * @return
     */
    @Select("SELECT count(*) FROM information WHERE type = #{type}")
    public int getInformationCountByType(int type);

    /**
     * 通过id获取该党建信息
     * @param inforId
     * @return
     */
    @Select("SELECT * FROM information WHERE id =#{inforId}")
    Information getInformationById(int inforId);

    /**
     * 获取最新的size数据
     * @param i
     * @param size
     * @return
     */
    @Select("SELECT * FROM information WHERE type =#{i} ORDER BY time DESC LIMIT #{size}")
    List<Information> getInformationByTypeTen(int i, int size);
}
